package com.lx.utils;

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

public class CookieEncrypTool {
	
	
	public static String encdeBase64(String cleartext){
		String result = "";		
		try{
			
			BASE64Encoder encoder = new BASE64Encoder();
			result =  encoder.encode(cleartext.getBytes("utf-8"));
			
		}catch(Exception e){
			e.printStackTrace();
		}
		
		return result;
	}
	
	public static String decodeBase64(String cleartext){
		String result = "";		
		try{
			
			BASE64Decoder decoder = new BASE64Decoder();
			result =  new String(decoder.decodeBuffer(cleartext), "UTF-8");
			
		}catch(Exception e){
			e.printStackTrace();
		}
		
		return result;
	}
}
